[SAI-PTF] API Logger - reformat dict in return value#1690
Merged
richardyu-ms merged 1 commit intoopencomputeproject:v1.11from Dec 22, 2022
Merged
[SAI-PTF] API Logger - reformat dict in return value#1690richardyu-ms merged 1 commit intoopencomputeproject:v1.11from
richardyu-ms merged 1 commit intoopencomputeproject:v1.11from
Conversation
Why
Base on some requirement, when logging the return value is a dict, need return the value for each key as a string.
For example, returning this.
```
"[{
'client': <sai_thrift.sai_rpc.Client object at 0x7fd9b46861d0>,
'port_oid': 4294967303,
'hw_lane_list': sai_thrift_object_list_t(count=100, idlist=[1,2,34])
}]"
```
it returned as (see the ' around the value too below)
```
"[{
'client': '<sai_thrift.sai_rpc.Client object at 0x7fd9b46861d0>',
'port_oid': '4294967303',
'hw_lane_list': 'sai_thrift_object_list_t(count=100, idlist=[1,2,34])'
}]"
```
How
Convert the dict value to string
Test:
Unit test and DUT test
Signed-off-by: richardyu-ms <richard.yu@microsoft.com>
Gfrom2016
approved these changes
Dec 22, 2022
richardyu-ms
added a commit
to richardyu-ms/sonic-sairedis
that referenced
this pull request
Dec 22, 2022
Include change - opencomputeproject/SAI@1390cee opencomputeproject/SAI#1690 Signed-off-by: richardyu-ms <richard.yu@microsoft.com>
richardyu-ms
added a commit
to sonic-net/sonic-sairedis
that referenced
this pull request
Dec 22, 2022
Include change - opencomputeproject/SAI@1390cee opencomputeproject/SAI#1690 Signed-off-by: richardyu-ms <richard.yu@microsoft.com> Signed-off-by: richardyu-ms <richard.yu@microsoft.com>
richardyu-ms
added a commit
to richardyu-ms/SAI
that referenced
this pull request
Jan 3, 2023
…ect#1690) Why Base on some requirement, when logging the return value is a dict, need return the value for each key as a string. For example, returning this. ``` "[{ 'client': <sai_thrift.sai_rpc.Client object at 0x7fd9b46861d0>, 'port_oid': 4294967303, 'hw_lane_list': sai_thrift_object_list_t(count=100, idlist=[1,2,34]) }]" ``` it returned as (see the ' around the value too below) ``` "[{ 'client': '<sai_thrift.sai_rpc.Client object at 0x7fd9b46861d0>', 'port_oid': '4294967303', 'hw_lane_list': 'sai_thrift_object_list_t(count=100, idlist=[1,2,34])' }]" ``` How Convert the dict value to string Test: Unit test and DUT test Signed-off-by: richardyu-ms <richard.yu@microsoft.com> Signed-off-by: richardyu-ms <richard.yu@microsoft.com>
richardyu-ms
added a commit
that referenced
this pull request
Jan 3, 2023
Why
Base on some requirement, when logging the return value is a dict, need return the value for each key as a string.
For example, returning this.
```
"[{
'client': <sai_thrift.sai_rpc.Client object at 0x7fd9b46861d0>,
'port_oid': 4294967303,
'hw_lane_list': sai_thrift_object_list_t(count=100, idlist=[1,2,34])
}]"
```
it returned as (see the ' around the value too below)
```
"[{
'client': '<sai_thrift.sai_rpc.Client object at 0x7fd9b46861d0>',
'port_oid': '4294967303',
'hw_lane_list': 'sai_thrift_object_list_t(count=100, idlist=[1,2,34])'
}]"
```
How
Convert the dict value to string
Test:
Unit test and DUT test
Signed-off-by: richardyu-ms <richard.yu@microsoft.com>
Signed-off-by: richardyu-ms <richard.yu@microsoft.com>
Signed-off-by: richardyu-ms <richard.yu@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Base on some requirement, when logging the return value is a dict, need return the value for each key as a string.
For example, returning this.
it returned as (see the ' around the value too below)
How
Convert the dict value to string
Test:
Unit test and DUT test
Signed-off-by: richardyu-ms richard.yu@microsoft.com